package com.flying.pas.form.service;

import com.flying.common.annotation.DaoCreate;
import com.flying.common.annotation.DaoQuery;
import com.flying.common.annotation.DaoRemove;
import com.flying.common.annotation.DaoUpdate;
import com.flying.common.util.Codes;
import com.flying.framework.annotation.MethodInfo;
import com.flying.framework.annotation.Param;
import com.flying.framework.annotation.Service;
import com.flying.framework.model.ActionResult;
import com.flying.framework.model.QueryResult;
import com.flying.framework.service.AbstractService;
import com.flying.pas.form.model.Action;

@Service(value="ActionService", desc="表单操作")
public class ActionService extends AbstractService{
        
	@MethodInfo("新增")
	@DaoCreate(entity=Action.ENTITY_NAME)
	public Action create(
			@Param(value=Action.FORM_ID, required=true,	desc="表单") Long form_id,
			@Param(value=Action.TITLE, required=true,	desc="标题") String title,
			@Param(value=Action.ICON_CLS, required=false,	desc="显示风格") String icon_cls,
			@Param(value=Action.ACTION, required=true,	desc="操作行为") String action,
			@Param(value=Action.ORDER_INDEX, required=false,	desc="顺序") Integer order_index,
			@Param(value=Action.PERM_ID, required=false,	desc="权限") Long perm_id,
			
			@Param(value=Action.REMARKS, required=false,	desc="说明") String remarks
		) throws Exception {
		
		return null;
	}

	@MethodInfo("修改")
	@DaoUpdate(entity=Action.ENTITY_NAME)
	public ActionResult update(
			@Param(value=Action.ACTION_ID, required=true,	desc="操作ID") Long action_id,
			@Param(value=Action.TITLE, required=true,	desc="标题") String title,
			@Param(value=Action.ICON_CLS, required=false,	desc="显示风格") String icon_cls,
			@Param(value=Action.ACTION, required=true,	desc="操作行为") String action,
			@Param(value=Action.ORDER_INDEX, required=false,	desc="顺序") Integer order_index,
			@Param(value=Action.PERM_ID, required=false,	desc="权限") Long perm_id,
			
			@Param(value=Action.REMARKS, required=false,	desc="说明") String remarks
		) throws Exception {
		
		return null;
	}

	@MethodInfo("删除")
	@DaoRemove(entity=Action.ENTITY_NAME)
	public ActionResult remove(
			@Param(value=Action.ACTION_ID, required=true,	desc="操作ID") Long action_id
		) throws Exception {
		return null;
	}

	@MethodInfo("删除")
	@DaoRemove(entity=Action.ENTITY_NAME)
	public ActionResult removeByFormId(
			@Param(value=Action.FORM_ID, required=true,	desc="表单ID") Long form_id
		) throws Exception {
		return null;
	}

	@MethodInfo("搜索")
	@DaoQuery(entity=Action.ENTITY_NAME, pageable=true, modelClass=Action.class, osql="order by order_index")
	public QueryResult<Action> findAll(
			@Param(value=Action.FORM_ID, required=true,	desc="表单") Long form_id,
			@Param(value=Codes.PAGE_NUM, 	required=false, desc="分页页号，默认0") int page,
			@Param(value=Codes.PAGE_SIZE, 	required=false, desc="分页大小，默认10") int rows) throws Exception {
		return null;
	}

	@MethodInfo("搜索")
	@DaoQuery(entity=Action.ENTITY_NAME, pageable=false, modelClass=Action.class, osql="order by order_index")
	public QueryResult<Action> findByFormId(
			@Param(value=Action.FORM_ID, required=true,	desc="表单ID") Long form_id) throws Exception {
		return null;
	}

	@MethodInfo("查询")
	@DaoQuery(entity=Action.ENTITY_NAME, single=true, throwsNotFoundException=true )
	public Action findById(
			@Param(value=Action.ACTION_ID, required=true,	desc="操作ID") Long action_id
		) throws Exception {
		return null;
	}

}